package com.example.aircraft.bullet;

import java.util.LinkedList;
import java.util.List;

/**
 * 散射版弹幕
 */
public class Cluster implements LaunchBarrage{
    @Override
    public List<AbstractBullet> Launch(int locationX, int locationY, int power, String Type){
        List<AbstractBullet> res = new LinkedList<>();
        int x = locationX;
        int y = locationY;
        int speedx = 0;
        int speedy = 5;
        AbstractBullet abstractBullet;
        for(int i=0; i<3; i++){
            // 子弹发射位置相对飞机位置向前偏移
            // 多个子弹横向分散
            abstractBullet = BulletFactory.dispatchBullet(Type, x + (i*2 - 3)*20, y, speedx, speedy, power);
            res.add(abstractBullet);
        }
        return res;
    }
}
